package com.duxd.springsecurityfinal.springsecurityfinal.mvc.config;

import com.duxd.springsecurityfinal.springsecurityfinal.security.config.AuthenticationRequestMappingHandlerMapping;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

/**
 * @author dong
 * @date 2022/1/16 0016
 * 在mvc自动装配驱动下来注入自定义RequestMappingHandlerMapping
 * {@link EnableMvcAutoConfigRegistrations}
 */
@Deprecated
@Configuration(proxyBeanMethods = false)
public class WebMvcConfiguration extends WebMvcConfigurationSupport {

    @Override
    protected RequestMappingHandlerMapping createRequestMappingHandlerMapping() {
        return new AuthenticationRequestMappingHandlerMapping();
    }

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
    }
}
